#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int a, f;
    f = 0;
    string s;
    cin >> s;
    vector<char> v;

    for (int e = 0; e < s.size(); e++)
    {
        if (s[e] == '(')
        {
            v.push_back(s[e]);
        }

        else if (s[e] == ')' and v.size() != 0)
        {
            a = v[v.size() - 1];
            v.pop_back();
            if (a != '(')
            {
                f = 1;
                cout << "False";
                break;
            }
        }

        else if ((s[e] == ')' and v.size() == 0))
        {
            cout << "False";
            f = 1;
        }

        if (s[e] == '[')
        {
            v.push_back(s[e]);
        }

        else if (s[e] == ']' and v.size() != 0)
        {
            a = v[v.size() - 1];
            v.pop_back();
            if (a != '[')
            {
                f = 1;
                cout << "False";
                break;
            }
        }
        else if ((s[e] == ']' and v.size() == 0))
        {
            cout << "False";
            f = 1;
        }

        if (s[e] == '{')
        {
            v.push_back(s[e]);
        }

        else if (s[e] == '}' and v.size() != 0)
        {
            a = v[v.size() - 1];
            v.pop_back();
            if (a != '{')
            {
                f = 1;
                cout << "False";
                break;
            }
        }

        else if ((s[e] == '}' and v.size() == 0))
        {
            cout << "False";
            f = 1;
        }

        if (s[e] == '<')
        {
            v.push_back(s[e]);

        }

        else if (s[e] == '>' and v.size() != 0)
        {
            a = v[v.size() - 1];
            v.pop_back();
            if (a != '<')
            {
                cout << "False";
                f = 1;
                break;
            }
        }

        else if ((s[e] == '>' and v.size() == 0))
        {
            cout << "False";
        }
    }

    if (f == 0 and v.size() == 0)
        {
            cout << "True";
        }

    else if (f == 0 and v.size() > 0)
    {
        cout << "False";
    }

}
